package xyz.gzdxc.common.mysql.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

import java.io.Serializable;
import java.util.Date;

/**
 * the session information
 */
@Table("xh_cm_session")
public class SessionEntity implements Serializable {
    @Id
    private Long id;

    /**
     * the refer user table ID
     */
    @Column(value = "user_id")
    private Long userId;

    /**
     * the saved session when login
     */
    @Column(value = "login_session")
    private String loginSession;

    /**
     * the timeout time
     */
    @Column(value = "time_out")
    private Long timeOut;

    /**
     * the login IP
     */
    @Column(value = "ip")
    private String ip;

    /**
     * the login time
     */
    @Column(value = "login_time")
    private Date loginTime;

    /**
     * session timeout time
     */
    @Column(value = "session_time_out")
    private Date sessionTimeOut;

    /**
     * update time
     */
    @Column(value = "update_time")
    private Date updateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getLoginSession() {
        return loginSession;
    }

    public void setLoginSession(String loginSession) {
        this.loginSession = loginSession;
    }

    public Long getTimeOut() {
        return timeOut;
    }

    public void setTimeOut(Long timeOut) {
        this.timeOut = timeOut;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    public Date getSessionTimeOut() {
        return sessionTimeOut;
    }

    public void setSessionTimeOut(Date sessionTimeOut) {
        this.sessionTimeOut = sessionTimeOut;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "SessionEntity{" +
                "id=" + id +
                ", userId=" + userId +
                ", loginSession='" + loginSession + '\'' +
                ", timeOut=" + timeOut +
                ", ip='" + ip + '\'' +
                ", loginTime=" + loginTime +
                ", sessionTimeOut=" + sessionTimeOut +
                ", updateTime=" + updateTime +
                '}';
    }
}
